Detection of spam images

ABSTRACT

A method, system, and computer program product for analyzing image attachments to email messages and reliably determines whether the image includes spam, so that the message can be blocked. A method for processing email messages comprises processing an image included in or attached to an email message to determine whether the image includes features that indicate whether the image is spam and determining whether the image is spam based on the included features that indicate whether the image is spam.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to scanning images included in emails todetermine whether those images include undesired textual content.

2. Description of the Related Art

The prevalence of unsolicited commercial email, commonly known as spamhas grown rapidly and still growing. The corporate world and individualhome users are spending millions of dollars to combat spam. InternetService Providers (ISPs) have to cope with greatly increasing day-to-dayamounts of network traffic due to the increase in spam emails. If spamtraffic continues to grow, it may become unmanageable in the nearfuture.

Typically, spam has been fought by the use of software that scansincoming email messages to determine whether each message is spam.Typical methods for scanning and detecting that an email message is spaminclude email filtering based on the content of the email, DNS-basedblackhole lists (DNSBL), greylisting, spamtraps, enforcing technicalrequirements, checksumming systems to detect bulk email, and by puttingsome sort of cost on the sender via a Proof-of-work system or amicropayment.

Detecting spam based on the content of the email, either by detectingkeywords or by statistical means, is very popular. Such methods can bevery accurate when they are correctly tuned. As a result, spammers haveresorted to other techniques for sending spam. One such technique istermed “image spam”. In image spam, the text of the message is stored asan image, such as a GIF or JPEG image, and displayed in the email orattached to the email. This prevents text-based spam scanners fromdetecting and blocking spam messages.

Often, image spam contains nonsensical, computer-generated text whichsimply annoys the reader. However, a significant percentage of the spamemail contains images that actually provide the core meaning of amessage. Those images are frequently embedded into the HTML part of theMIME message, being actually a MIME attachment, making it appear as anintegral part of the content. In some cases the images are the onlyattachments in the otherwise blank messages. Either way, these imagesimpose a serious challenge for spam blocking software based on contentanalysis. Some spam filters currently block any messages containingembedded images. While such filters eliminate image spam, they alsoblock legitimate email having embedded images, such as signatures andlogos. Some spam filters use optical character recognition (OCR)technology to attempt to find the text in images attached to emailmessages. However, OCR techniques are time consuming and inaccurate,missing some spam and blocking some legitimate messages.

A need arises for a technique for analyzing image attachments to emailmessages and reliably determining whether the image includes spam, sothat the message can be blocked.

SUMMARY OF THE INVENTION

A method, system, and computer program product for analyzing imageattachments to email messages and reliably determines whether the imageincludes spam, so that the message can be blocked. The describedtechnique provides improved detection reliability and reducedcomputational costs compared to prior detection schemes. In addition,the described technique is language and character set independent.

A method for processing email messages comprises processing an imageincluded in or attached to an email message to determine whether theimage includes features that indicate whether the image is spam anddetermining whether the image is spam based on the included featuresthat indicate whether the image is spam. The processing may be performedby converting the image to have only luminance information, detectingcontiguous horizontal regions with distinctive luminance, and detectinghorizontal and vertical edges of the contiguous horizontal regions asthe features that indicate whether the image is spam. The determiningmay be performed by determining whether the image is spam based on aratio of a number of horizontal edges to a number of vertical edges. Thedetermining may be performed by determining that the image is spam whenthe ratio of a number of horizontal edges to a number of vertical edgesis greater than a threshold value. The threshold value may be includedin a range of approximately 10 to 15.

The contiguous horizontal regions with distinctive luminance may bedetected by performing horizontal smoothening on the image andperforming segmentation of the image. The horizontal smoothening may beperformed by combining multiple pixels by setting each of the combinedpixels to an average value of the combined pixels The segmentation ofthe image may be performed by computing an average luminance value ofthe image, dividing each horizontal line in the image into a pluralityof equal segments, and for each segment of each horizontal line in theimage determining an average and minimum luminance value of the segmentand marking each pixel of the segment as belonging to a foreground orbelonging to a background. The determining an average and minimumluminance value of the segment may be performed by determining that thebackground is brighter than a content when the average luminance valueof the segment is greater than a threshold value and that the backgroundis darker than the content when the average luminance value is less thanor equal to the threshold value, setting a value to be used to mark asegment as belonging to the background to black and a value to be usedto mark a segment as belonging to a foreground to white when thebackground is brighter than the content, and setting a value to be usedto mark a segment as belonging to the background to white and a value tobe used to mark a segment as belonging to a foreground to black when thebackground is darker than the content. The marking each pixel of thesegment as belonging to a foreground or belonging to a background may beperformed by marking all pixels of the segment as belonging to thebackground when the average and minimum luminance values of the segmentare equal, marking the pixel as belonging to the background when theluminance of the pixel is greater than the average luminance of thesegment, and marking the pixel as belonging to the fore when theluminance of the pixel is less than or equal to the average luminance ofthe segment.

BRIEF DESCRIPTION OF THE DRAWINGS

The details of the present invention, both as to its structure andoperation, can best be understood by referring to the accompanyingdrawings, in which like reference numbers and designations refer to likeelements.

FIG. 1 is an exemplary block diagram of a system in which the presentinvention may be implemented.

FIG. 2 is an exemplary flow diagram of a process of operation of animage spam scanner, according to the present invention.

FIG. 3 a is an exemplary illustration of an original image includingtext.

FIG. 3 b is an exemplary illustration of a converted image.

FIG. 3 c is an exemplary illustration of line detection.

FIG. 3 d is an exemplary illustration of horizontal edge detection.

FIG. 3 e is an exemplary illustration of vertical edge detection.

FIG. 4 is an exemplary flow diagram of text line detection.

FIG. 5 a is an exemplary illustration of an input image.

FIG. 5 b is an exemplary illustration of an output image.

FIG. 5 c is an exemplary illustration of an input image.

FIG. 5 d is an exemplary illustration of an output image.

FIG. 6 is an exemplary illustration of a process of line-ness rationcomputation.

FIG. 7 is an exemplary block diagram of a computer system, such as anemail server, in which the present invention may be implemented.

DETAILED DESCRIPTION OF THE INVENTION

A method, system, and computer program product for scanning imagesincluded in or attached to emails provides reliable detection of spamincluded in such images, but reduces the computing resources needed forsuch detection. The technique utilizes the fact that most of the imagesattached to the spam messages carry textual information rather thanpictures or any other type of graphical content. In addition, thetechnique is language and character set independent, that is, text thatis written horizontally of any language and any character set may bedetected without increasing the computing resources needed for suchdetection.

A block diagram of a system 100 in which the present invention may beimplemented is shown in FIG. 1. Email server 102 receives email messages104 via the Internet 106, or other network. The email messages areprocessed by email scanner 108. Email scanner 108 automates thehighlighting, removal or filtering of email spam, malware, and/or badcontent by scanning through incoming and outgoing emails in search oftraits typical of such undesirable items. Such scanning may includesearching for patterns in the headers or bodies of messages. Eachincoming email message is scanned to determine whether it is a dangerousspam email message, including malware or bad content, which is to bequarantined 110, a spam email message that is to be marked as SPAM 112and delivered to the recipients inbox 114, or a clean email message 116that is to be delivered as is to the recipient's inbox 114. Emailscanners 108 include a plurality of scanners 118A-N, each of which iscapable of scanning one or more different item types and scanning forone or more types of undesirable content. A scanner is a component thatcan run against an item to determine whether or not it has undesirablecontent, such as AntiVirus, AntiSpam, bad content, and other scanners.For example, scanners 118A-N include image spam scanner 118N, whichdetermines whether image files included in or attached to received emailmessages include spam.

An example of a process of operation 200 of an image spam scanner, suchas image spam scanner 118N, is shown in FIG. 2. It is best viewed inconjunction with FIGS. 3 a-e, which illustrate the results of theprocessing steps. Process 200 begins with step 202, in which an image tobe scanned to determine whether it includes image spam is loaded.Typically, the image is included in or attached to an email, but thepresent invention contemplates and is applicable to images obtained fromany source. An example of such an original image 302 is shown in FIG. 3a. In image 302, different lines of text are different colors.

In step 204, the image is converted to black and white, that is,luminance information only. An example of a converted image 304 is shownin FIG. 3 b. Typically, images found in the e-mail messages asattachments are in JPEG or GIF formats. An image, when read into thememory is typically stored as an array of RGB values −3 bytes per eachpixel, one byte for each of red, green, and blue. The resulting arraysize is 3*width*height of the original image. A common conversion fromthe RGB color space to YIQ (B/W) is performed as follows:

Luminance=0.3*R+0.59*G+0.11*B.

An alternative conversion formula gives even weights to each colorchannel:

Luminance=R/3+G/3+B/3

The alternative formula may improve performance with spam images, whichoften color differently each text line. It is desirable for processingsake that all text lines are expressed evenly on a transformed (B/W)image even though originally they had different colors.

In step 206, the lines of text are detected. This is done by detectingcontiguous regions of the image that have similar, distinctiveluminance. An example of line detection 306 is shown in FIG. 3 c. Instep 208, the horizontal edges (edges extending horizontally) of thedetected lines (contiguous regions) found in step 206 are detected. Anexample of such horizontal edge detection 308 is shown in FIG. 3 d. Instep 210, the vertical edges (edges extending vertically) of thedetected lines are detected. An example of such vertical edge detection310 is shown in FIG. 3 e. Finally, in step 212, a value that may betermed the “line-ness ratio” is calculated and it is determined whetherthe image is spam. The line-ness ratio is a ratio between the amount ofhorizontal and vertical edges. A higher number corresponds to a higherprobability of the image being spam.

A more detailed view of the process of text line detection performed instep 206 of FIG. 2 is shown in FIG. 4. The detection of text lines isperformed in two major stages: first image is horizontally “smoothened”(step 402) and next, basic image segmentation is performed (step 403).Horizontal smoothening, performed in step 402, is an important stage asit allows elimination of particular image elements (such as noise,glyphs and pictures) and transforming them into shapes. It is alsoimportant that the smoothening is performed in horizontal direction onlyto preserve upper and lower text line boundaries. One example ofsmoothening is to combine multiple pixels by setting each of thecombined pixels to the average value of the combined pixels.

Image segmentation, performed in step 403, is a basic means to isolatecontent from the image background. Its objective is to produce amonochrome (two-color or luminance) image having a pure white backgroundand a pure black foreground.

Firstly, each horizontal line is divided into a number n of equalsegments. Each segment after the processing will be assigned eitherbackground (white) or foreground (black) luminance. When all horizontallines are processed. Each segment is treated as a single pixel. Thisallows speeding up edge detection because now instead of processingevery pixel (in the horizontal direction) the algorithm processes only n“pixels”.

The segmentation process begins with step 404, in which an averageluminance value for the image is computed. In step 406, the image issegmented horizontally into n equal sized segments. For example, atypical image may be segmented into 10 segments. Then, for each segmentof each horizontal line in the image, steps 408-412 are performed inorder to mark each segment at belonging to the foreground or thebackground of the image. Thus, in step 408, for each segment of eachhorizontal line, the segment's average and minimum luminance values aredetermined. If the average and minimum luminance values of the segmentare equal, the segment is marked as belonging to the background of theimage. This may be considered “naïve” protection against “falsepositives”—solidly colored areas that don't contain text. If the segmentis marked as background, then the process proceeds to the next segment.If the segment has not yet been marked, then in step 410, the foregroundand background luminances are determined. In particular, if the averageluminance value of the segment is greater than a threshold value, thenthe process assumes that the background is brighter than the content(text). Likewise, if the average luminance value is less than or equalto the threshold value, then the process assumes that the background isdarker than the content (text). The values with which the pixels are tobe marked as foreground or background in step 412 are set accordingly.For example, if the values to be used for marking are denoted as BG_CLR(for the background) and FG_CLR (for the foreground), then if thebackground is brighter than the content, BG_CLR is set equal to WHITE(for example, 255) and FG_CLR is set equal to BLACK (for example, 0).Likewise, if the background is darker than the content, BG_CLR is setequal to BLACK (for example, 0) and FG_CLR is set equal to WHITE (forexample, 255).

Then, in step 412, each pixel of the segment being processed is markedas foreground or background. Specifically, if the luminance of the pixelis greater than the average luminance determined in step 408, then thepixel is marked as background, BG_CLR. Likewise, if the luminance of thepixels is less than or equal to the average luminance, then the pixel ismarked as foreground, FG_CLR. It is to be noted that regardless of theoriginal image background luminance, after processing, the background isalways white and the content is always black.

Examples of input and output images are shown in FIGS. 5 a-d. Forexample, in FIG. 5 a, input image 502 has a dark background with lightertext. In processed output image 504, shown in FIG. 5 b, the backgroundis white and the content is black. In FIG. 5 c, input image 506 has alight background with darker text. In processed output image 508, shownin FIG. 5 d, the background is white and the content is black.

The threshold value used in step 410 is typically set to the middle ofthe luminance range. For example, for a luminance range of black=0.0 andwhite=255, the threshold may be set to 128. Alternatively, rather than asimple threshold, an uncertainty window may be used in which allluminance values inside the “uncertainty window” are considered beingbackground (or foreground). For example, the window may be computed as:Low-20*Average/255 High=20*(1−Average/255). In other words, if the coloraverage is 128, the uncertainty window is [128−10, 128+10]. Likewise, ifthe average is 200, the window is [200−15.7, 200+4.3].

The processing performed in steps 208-212 of FIG. 2 is shown in greaterdetail in FIG. 6. In steps 208-212 of FIG. 2, the horizontal andvertical edges present in the image are detected and then the“line-ness” ratio (amount of lines vs. amount of other shapes) iscomputed using the detected horizontal and vertical edges. Thehorizontal and vertical edges are detected using the processed outputimage described above, in which the background is always white and thecontent is always black. This image has been processed to improve edgedetection processing. Once the horizontal and vertical edges have beendetected the number of horizontal edges and the number of vertical edgesare counted. The desired value is a ratio between the number ofhorizontal edges and the number of vertical edges.

An example of this processing is shown in FIG. 6. In this example, aluminance distribution 602 is shown (“0” represents white pixels and “*”represents black). Both horizontal and vertical edge detection areperformed by detecting transitions from white to black and from black towhite in the processed output image. Horizontal edge detection 604 isperformed and the total number of horizontal edges are counted (in thisexample there are 24 horizontal edges). Vertical edge detection 606 isperformed and the total number of vertical edges are counted (in thisexample there are 6 vertical edges). The line-ness ratio is computed asthe ratio of the number of horizontal edges divided by the number ofvertical edges (in this example the ratio is 4). As can be seen from theexample, the longer (in horizontal direction) a shape is, the higher theratio becomes. Thus, the higher the line-ness ratio of an image, themore likely it is that the image includes text.

The determination of whether an image is spam (includes text) isgenerally based on the computed line-ness ratio. It is difficult totheoretically establish a threshold for the line-ness ratio at which ashape is determined to be text. However, experimental results indicatethat a value between 10 and 15 generally works well. In addition to theline-ness ratio, additional factors may be considered in determiningwhether an image is spam. For example, the image analysis software usedmay be unable to open a particular image that is attached to an emailmessage. Such invalid images attached to email messages may be invalidbecause they are damaged, corrupted, incorrectly formatted, etc.Experimental processing indicates that invalid messages are more likelythan not to include spam. Therefore, one enhancement is to categorizeinvalid message as spam a priori. Another way to deal with such messagesis to increase a heuristic score indicating the likelihood that theimage is spam.

In the case of noisy processed images, such as the exemplary image 504,shown in FIG. 5 b, it is desirable to eliminate lines only one pixel inthickness when performing the edge count. Lines one pixel in thicknessare unlikely to represent text, and so are not included in the edgecount. Lines greater than one pixel in thickness are more likely torepresent text, and so are included in the edge count. On the otherhand, it has been experimentally found that images that include many onepixel lines are more likely to include spam. Therefore, an enhancementis to count one pixel lines and increase a heuristic score indicatingthe likelihood that the image is spam.

An exemplary block diagram of a computer system 700, such as an emailserver, in which the present invention may be implemented, is shown inFIG. 7. Computer system 700 is typically a programmed general-purposecomputer system, such as a personal computer, workstation, serversystem, and minicomputer or mainframe computer. Computer system 700includes one or more processors (CPUs) 702A-702N, input/output circuitry704, network adapter 706, and memory 708. CPUs 702A-702N execute programinstructions in order to carry out the functions of the presentinvention. Typically, CPUs 702A-702N are one or more microprocessors,such as an INTEL PENTIUM® processor. FIG. 7 illustrates an embodiment inwhich computer system 700 is implemented as a single multi-processorcomputer system, in which multiple processors 702A-702N share systemresources, such as memory 708, input/output circuitry 704, and networkadapter 706. However, the present invention also contemplatesembodiments in which computer system 700 is implemented as a pluralityof networked computer systems, which may be single-processor computersystems, multi-processor computer systems, or a mix thereof.

Input/output circuitry 704 provides the capability to input data to, oroutput data from, computer system 700. For example, input/outputcircuitry may include input devices, such as keyboards, mice, touchpads,trackballs, scanners, etc., output devices, such as video adapters,monitors, printers, etc., and input/output devices, such as, modems,etc. Network adapter 706 interfaces computer system 700 withInternet/intranet 710. Internet/intranet 710 may include one or morestandard local area network (LAN) or wide area network (WAN), such asEthernet, Token Ring, the Internet, or a private or proprietary LAN/WAN.

Memory 708 stores program instructions that are executed by, and datathat are used and processed by, CPU 702 to perform the functions ofcomputer system 700. Memory 708 may include electronic memory devices,such as random-access memory (RAM), read-only memory (ROM), programmableread-only memory (PROM), electrically erasable programmable read-onlymemory (EEPROM), flash memory, etc., and electro-mechanical memory, suchas magnetic disk drives, tape drives, optical disk drives, etc., whichmay use an integrated drive electronics (IDE) interface, or a variationor enhancement thereof, such as enhanced IDE (EIDE) or ultra directmemory access (UDMA), or a small computer system interface (SCSI) basedinterface, or a variation or enhancement thereof, such as fast-SCSI,wide-SCSI, fast and wide-SCSI, etc, or a fiber channel-arbitrated loop(FC-AL) interface.

In the example shown in FIG. 7, memory 708 includes email processingsoftware 712 and operating system 714. Email processing software 712includes email scanners 108, which include scanners 118A-N, includingimage spam scanner 118N, quarantined emails 110, spam emails 112, cleanemails 116, recipient inboxes 114, and, as well as additionalfunctionality that is not shown. Email scanners 108 automate thehighlighting, removal or filtering of email spam by scanning throughincoming and outgoing emails in search of traits typical of spam. Suchscanning may include searching for patterns in the headers or bodies ofmessages. Each incoming email message is scanned to determine whether itis a spam email message that is to be marked as SPAM, a dangerous spamemail message that is to be quarantined, or a clean email message thatis to be delivered as is to the recipient's inbox. In addition, emailscanner 108 scans the email address of the sender of the email, and mayalso scan the first and last name of the sender of the email. Scanners118A-N scan the items to determine their status. Each incoming emailmessage is scanned to determine whether it is a dangerous spam emailmessage that is to be quarantined 110, a spam email message that is tobe marked as SPAM 112 and delivered to the recipient's inbox 114, or aclean email message 116 that is to be delivered as is to the recipient'sinbox 114. Image spam scanner 118N scans images included in or attachedto email messages to determine whether the image includes spam accordingto the processed described above. Operating system 714 provides overallsystem functionality.

As shown in FIG. 7, the present invention contemplates implementation ona system or systems that provide multi-processor, multi-tasking,multi-process, and/or multi-thread computing, as well as implementationon systems that provide only single processor, single thread computing.Multi-processor computing involves performing computing using more thanone processor. Multi-tasking computing involves performing computingusing more than one operating system task. A task is an operating systemconcept that refers to the combination of a program being executed andbookkeeping information used by the operating system. Whenever a programis executed, the operating system creates a new task for it. The task islike an envelope for the program in that it identifies the program witha task number and attaches other bookkeeping information to it. Manyoperating systems, including UNIX®, OS/2®, and Windows®, are capable ofrunning many tasks at the same time and are called multitaskingoperating systems. Multi-tasking is the ability of an operating systemto execute more than one executable at the same time. Each executable isrunning in its own address space, meaning that the executables have noway to share any of their memory. This has advantages, because it isimpossible for any program to damage the execution of any of the otherprograms running on the system. However, the programs have no way toexchange any information except through the operating system (or byreading files stored on the file system). Multi-process computing issimilar to multi-tasking computing, as the terms task and process areoften used interchangeably, although some operating systems make adistinction between the two.

It is important to note that while the present invention has beendescribed in the context of a fully functioning data processing system,those of ordinary skill in the art will appreciate that the processes ofthe present invention are capable of being distributed in the form of acomputer readable medium of instructions and a variety of forms and thatthe present invention applies equally regardless of the particular typeof signal bearing media actually used to carry out the distribution.Examples of computer readable media include recordable-type media suchas floppy disc, a hard disk drive, RAM, and CD-ROM's, as well astransmission-type media, such as digital and analog communicationslinks.

Although specific embodiments of the present invention have beendescribed, it will be understood by those of skill in the art that thereare other embodiments that are equivalent to the described embodiments.For example, the present invention may be advantageously employed inscanning outgoing email messages, as well as incoming email messages.Accordingly, it is to be understood that the invention is not to belimited by the specific illustrated embodiments, but only by the scopeof the appended claims.

1. A method of processing email messages, comprising: processing animage included in or attached to an email message to determine whetherthe image includes features that indicate whether the image is spam; anddetermining whether the image is spam based on the included featuresthat indicate whether the image is spam.
 2. The method of claim 1,wherein the processing is performed by: converting the image to haveonly luminance information; detecting contiguous horizontal regions withdistinctive luminance; and detecting horizontal and vertical edges ofthe contiguous horizontal regions as the features that indicate whetherthe image is spam.
 3. The method of claim 2, wherein the determining isperformed by: determining whether the image is spam based on a ratio ofa number of horizontal edges to a number of vertical edges.
 4. Themethod of claim 3, wherein the determining is performed by: determiningthat the image is spam when the ratio of a number of horizontal edges toa number of vertical edges is greater than a threshold value.
 5. Themethod of claim 4, wherein the threshold value is included in a range ofapproximately 10 to
 15. 6. The method of claim 2, wherein the contiguoushorizontal regions with distinctive luminance are detected by:performing horizontal smoothening on the image; and performingsegmentation of the image.
 7. The method of claim 6, wherein thehorizontal smoothening is performed by: combining multiple pixels bysetting each of the combined pixels to an average value of the combinedpixels
 8. The method of claim 6, wherein the segmentation of the imageis performed by: computing an average luminance value of the image;dividing each horizontal line in the image into a plurality of equalsegments; and for each segment of each horizontal line in the image:determining an average and minimum luminance value of the segment, andmarking each pixel of the segment as belonging to a foreground orbelonging to a background.
 9. The method of claim 8, wherein thedetermining an average and minimum luminance value of the segment areperformed by: determining that the background is brighter than a contentwhen the average luminance value of the segment is greater than athreshold value and that the background is darker than the content whenthe average luminance value is less than or equal to the thresholdvalue; setting a value to be used to mark a segment as belonging to thebackground to black and a value to be used to mark a segment asbelonging to a foreground to white when the background is brighter thanthe content; and setting a value to be used to mark a segment asbelonging to the background to white and a value to be used to mark asegment as belonging to a foreground to black when the background isdarker than the content.
 10. The method of claim 9, wherein the markingeach pixel of the segment as belonging to a foreground or belonging to abackground are performed by: marking all pixels of the segment asbelonging to the background when the average and minimum luminancevalues of the segment are equal; marking the pixel as belonging to thebackground when the luminance of the pixel is greater than the averageluminance of the segment; and marking the pixel as belonging to the forewhen the luminance of the pixel is less than or equal to the averageluminance of the segment.
 11. A system for processing email messagescomprising: a processor operable to execute computer programinstructions; a memory operable to store computer program instructionsexecutable by the processor; and computer program instructions stored inthe memory and executable to perform the steps of: processing an imageincluded in or attached to an email message to determine whether theimage includes features that indicate whether the image is spam; anddetermining whether the image is spam based on the included featuresthat indicate whether the image is spam.
 12. The system of claim 11,wherein the processing is performed by: converting the image to haveonly luminance information; detecting contiguous horizontal regions withdistinctive luminance; and detecting horizontal and vertical edges ofthe contiguous horizontal regions as the features that indicate whetherthe image is spam.
 13. The system of claim 12, wherein the determiningis performed by: determining whether the image is spam based on a ratioof a number of horizontal edges to a number of vertical edges.
 14. Thesystem of claim 13, wherein the determining is performed by: determiningthat the image is spam when the ratio of a number of horizontal edges toa number of vertical edges is greater than a threshold value.
 15. Thesystem of claim 14, wherein the threshold value is included in a rangeof approximately 10 to
 15. 16. The system of claim 12, wherein thecontiguous horizontal regions with distinctive luminance are detectedby: performing horizontal smoothening on the image; and performingsegmentation of the image.
 17. The system of claim 16, wherein thehorizontal smoothening is performed by: combining multiple pixels bysetting each of the combined pixels to an average value of the combinedpixels
 18. The system of claim 16, wherein the segmentation of the imageis performed by: computing an average luminance value of the image;dividing each horizontal line in the image into a plurality of equalsegments; and for each segment of each horizontal line in the image:determining an average and minimum luminance value of the segment, andmarking each pixel of the segment as belonging to a foreground orbelonging to a background.
 19. The system of claim 18, wherein thedetermining an average and minimum luminance value of the segment areperformed by: determining that the background is brighter than a contentwhen the average luminance value of the segment is greater than athreshold value and that the background is darker than the content whenthe average luminance value is less than or equal to the thresholdvalue; setting a value to be used to mark a segment as belonging to thebackground to black and a value to be used to mark a segment asbelonging to a foreground to white when the background is brighter thanthe content; and setting a value to be used to mark a segment asbelonging to the background to white and a value to be used to mark asegment as belonging to a foreground to black when the background isdarker than the content.
 20. The system of claim 19, wherein the markingeach pixel of the segment as belonging to a foreground or belonging to abackground are performed by: marking all pixels of the segment asbelonging to the background when the average and minimum luminancevalues of the segment are equal; marking the pixel as belonging to thebackground when the luminance of the pixel is greater than the averageluminance of the segment; and marking the pixel as belonging to the forewhen the luminance of the pixel is less than or equal to the averageluminance of the segment.
 21. A computer program product for processingincoming email messages comprising: a computer readable storage medium;computer program instructions, recorded on the computer readable storagemedium, executable by a processor, for performing the steps ofprocessing an image included in or attached to an email message todetermine whether the image includes features that indicate whether theimage is spam; and determining whether the image is spam based on theincluded features that indicate whether the image is spam.
 22. Thecomputer program product of claim 21, wherein the processing isperformed by: converting the image to have only luminance information;detecting contiguous horizontal regions with distinctive luminance; anddetecting horizontal and vertical edges of the contiguous horizontalregions as the features that indicate whether the image is spam.
 23. Thecomputer program product of claim 22, wherein the determining isperformed by: determining whether the image is spam based on a ratio ofa number of horizontal edges to a number of vertical edges.
 24. Thecomputer program product of claim 23, wherein the determining isperformed by: determining that the image is spam when the ratio of anumber of horizontal edges to a number of vertical edges is greater thana threshold value.
 25. The computer program product of claim 24, whereinthe threshold value is included in a range of approximately 10 to 15.26. The computer program product of claim 22, wherein the contiguoushorizontal regions with distinctive luminance are detected by:performing horizontal smoothening on the image; and performingsegmentation of the image.
 27. The computer program product of claim 26,wherein the horizontal smoothening is performed by: combining multiplepixels by setting each of the combined pixels to an average value of thecombined pixels
 28. The computer program product of claim 26, whereinthe segmentation of the image is performed by: computing an averageluminance value of the image; dividing each horizontal line in the imageinto a plurality of equal segments; and for each segment of eachhorizontal line in the image: determining an average and minimumluminance value of the segment, and marking each pixel of the segment asbelonging to a foreground or belonging to a background.
 29. The computerprogram product of claim 28, wherein the determining an average andminimum luminance value of the segment are performed by: determiningthat the background is brighter than a content when the averageluminance value of the segment is greater than a threshold value andthat the background is darker than the content when the averageluminance value is less than or equal to the threshold value; setting avalue to be used to mark a segment as belonging to the background toblack and a value to be used to mark a segment as belonging to aforeground to white when the background is brighter than the content;and setting a value to be used to mark a segment as belonging to thebackground to white and a value to be used to mark a segment asbelonging to a foreground to black when the background is darker thanthe content.
 30. The computer program product of claim 29, wherein themarking each pixel of the segment as belonging to a foreground orbelonging to a background are performed by: marking all pixels of thesegment as belonging to the background when the average and minimumluminance values of the segment are equal; marking the pixel asbelonging to the background when the luminance of the pixel is greaterthan the average luminance of the segment; and marking the pixel asbelonging to the fore when the luminance of the pixel is less than orequal to the average luminance of the segment.